/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165;

import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Matúš
 */
@Local
public interface ReaderDAOLocal {
    
    /**
     * Generates unique id for the new reader and stores this reader into database.
     *
     * @param reader reader entity to be created
     * @return created reader with new id
     * @throws IllegalArgumentException if reader is null, reader's attributes are not correct or sufficient
     */
    Reader createReader(Reader reader) throws IllegalArgumentException;
    
    /**
     * Returns a list of all readers in the database.
     *
     * @return list of all books in the database.
     */
    List<Reader> findAllReaders();
    
    /**
     * Returns reader with given email.
     *
     * @param email reader's email
     * @return reader with given email or null if such reader does not exist
     * @throws IllegalArgumentException if email is null or empty string
     */
    public Reader findReaderByEmail(String email) throws IllegalArgumentException;

    /**
     * Updates reader that is already in database.
     *
     * @param reader updated reader to be stored into database
     * @throws IllegalArgumentException if reader is null or reader's attributes are not correct
     */
    public void updateReader(Reader reader) throws IllegalArgumentException;
    
    /**
     * Deletes reader from database.
     *
     * @param reader reader to be deleted from database
     * @throws IllegalArgumentException if reader is null
     */
    public void deleteReader(Reader reader) throws IllegalArgumentException;
}
